Docker : Add Container Images
2015/11/12 |
Add Container Images.
|
|
[1] | For exmaple, update official image with installing httpd and add it as a new image for containers. The container is generated every time for executing "docker run" command, so add the latest executed container like follows. |
# show list of images [root@dlp ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE docker.io/fedora latest c7d2f0130dae 9 days ago 204.3 MB # start a Container and install httpd [root@dlp ~]# docker run fedora /bin/bash -c "dnf -y update; dnf -y install httpd" docker ps -a | head -2 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 726fb955d8f6 fedora "/bin/bash -c 'dnf -y" About a minute ago Exited (0) 9 seconds ago naughty_banach # add the image with httpd [root@dlp ~]# docker commit 726fb955d8f6 images/fedora_httpd 539e352eb03146fa91b130c2aaae4b99b2f79569a37bcbce72c4c83b996e0a61 # show list [root@dlp ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE images/fedora_httpd latest 539e352eb031 23 seconds ago 549.2 MB docker.io/fedora latest c7d2f0130dae 9 days ago 204.3 MB # generate a Container from the new image and make sure httpd exists [root@dlp ~]# docker run images/fedora_httpd /usr/sbin/httpd -V AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.5. Set the 'ServerName' directive globally to suppress this message Server version: Apache/2.4.17 (Fedora) Server built: Oct 28 2015 11:18:40 Server's Module Magic Number: 20120211:51 Server loaded: APR 1.5.2, APR-UTIL 1.5.4 Compiled using: APR 1.5.2, APR-UTIL 1.5.4 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... ..... ..... |